package com.woniuxy.microsystemserver.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.woniuxy.bean.ResultBean;
import com.woniuxy.microsystemserver.dao.AppCodeDao;
import com.woniuxy.microsystemserver.service.AppCodeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Auther: yeyang  <br/>
 * Date: 2021/4/20 0020:上午 11:05  <br/>
 * Description:
 */
@Service
public class AppCodeSercieImpl implements AppCodeService {
    @Resource
    private AppCodeDao appCodeDao;

    @Override
    public ResultBean updateFund(String key) {
        if(key==null){
            return ResultBean.builder().code(200).msg("值不能为空").build();
        }
        int res=appCodeDao.updateFund(key);
        if(res<1){
            return ResultBean.builder().code(200).msg("修改失败").build();
        }
        return ResultBean.builder().code(200).msg("修改成功").build();
    }

    @Override
    public ResultBean updateCertification(String key) {
        if(key==null){
            return ResultBean.builder().code(200).msg("值不能为空").build();
        }
        if(key.trim().isEmpty()){
            return ResultBean.builder().code(200).msg("请正确输入").build();
        }
        int res=appCodeDao.updateCertification(key);
        if(res<1){
            return ResultBean.builder().code(200).msg("修改失败").build();
        }
        return ResultBean.builder().code(200).msg("修改成功").build();
    }

    @Override
    public ResultBean updateGold(String key) {
        if(key==null){
            return ResultBean.builder().code(200).msg("值不能为空").build();
        }
        if(key.trim().isEmpty()){
            return ResultBean.builder().code(200).msg("请正确输入").build();
        }
        int res=appCodeDao.updateGold(key);
        if(res<1){
            return ResultBean.builder().code(200).msg("修改失败").build();
        }
        return ResultBean.builder().code(200).msg("修改成功").build();
    }
}
